Class 7 Lab - Geoprocessing Tools

Class 7 Lab Preview

This week’s lab will feature exploration of the following:

  1. Geoprocessing Techniques
  2. Calculating Feature Geometry
  3. Field Calculator Selections
  4. SQL Assignments

Lab Steps:

  • Outline of Spatial Problem:

  • Utilizing the city of Swellendam (2 hours’ east of Cape Town in the Western Cape of South Africa) as a project area, a series of proximity and areal parameters can be used to find most suitable real estate locations. The parameters are as follows:

    • Real Estate needs to be within the city of Swellendam.

    • Within reasonable driving distance of a school (1km).

    • Building footprints need to be at least 100m squared in size.

    • 50 meters or less distance from a main road.

    • Within 500 meters of a restaurant.

  • Each of the parameters noted above can be determined via GIS geoprocessing.

  • To answer these questions, we are going to need the following data:

    • The residential properties (buildings) in the area

    • The roads in and around the town

    • The location of schools and restaurants

    • The size of buildings

  • To start, we will download data needed for the lab from Class 7 Lab Data. Following the download, we will unzip the data and point our GIS to the data and secure a file path for the duration of the lab. Data download includes:

    • training_data.gpkg Geopackage database:

      • buildings

      • roads

      • restaurants

      • schools

Note: the landuse.sqlite database file is for context only; its not necessary for the analysis steps below.

Note: disregard the vector_analysis.gpkg for the time being. More information on the gpkg file format located.

HERE.

  • Data loaded into QGIS:

Data Preview

  • Step 1 - Geoprocessing - Select by attribute:

  • Attributes can be selected/filtered by several means, including Filter from the layer menu:

Utilizing Filter to Select Features

  • Enact Filter on the roads layer, selecting only specific road types.

  • Using the following expression, footway, path, unclassified, track and NULL highway types will be excluded, returning only those road segments that are NOT part of the exclusion list:

  • "highway" NOT IN ('footway', 'path', 'unclassified', 'track') AND "highway" != 'NULL'

Filter SQL

  • 466 rows should be returned meeting the criteria. Note the filter icon now beside the layer in the Layer Panel:

Filter SQL Result

  • Note the resulting features in Map Canvas:

Filter SQL Result

  • Step 2 - Map Projections - Reproject:

Since the primary input features are derived from OpenStreetMap - just like the origination data for the Class 6 assignment - we need to reproject features before proceeding. The correct UTM for this location is as follows:

  • WGS 84 / UTM zone 34S

  • Instead of reprojecting each feature as would be needed performing a similar analysis outside this lab exercise, all the necessary features have already been prepared and reprojected. In the case of the roads layer, the filter performed in Step 1 is now part of the reprojection export so expect roads_34s to contain the filtered 466 features. The reprojected features now live in the vector_analysis.gpkg. Close the current project and open a blank .qgs projects and point to the vector_analysis.gpkg. Note the new CRS WGS 84 / UTM zone 34S:

vector_analysis.gpkg

vector_analysis.gpkg

vector_analysis.gpkg

  • Step 3 - Geoprocessing - Proximity Analysis - Buffer:

  • Select the Buffer tool:

Buffer Tool

  • Populate the tool as follows with a 50 meter distance.
  • Name the output as roads_buffer_50m and choose the vector_analysis.gpkg as the output destination. Conversely, you can make a new exports.gpkg for all the geoprocessing exports that will be done in this lab:

Populate Buffer Tool

  • Buffer Result:

Buffer Result

  • Step 4 - Geoprocessing - Proximity Analysis - Buffer - Dissolve #1:

  • As seen in the image above, the Buffer results in individual segments per road segment. However, the condition that is desired is a Dissolved Buffer; that is, as simple proximity distance from all roads, not separate segments with their own proximity geometry. To do this, re-run the tool and populate the same, but this time Toogle ON Dissolve result and name the feature roads_buffer_50m_dissolved:

Dissolve Parameters

  • Dissolved Buffer Result:

Dissolved Buffer Result

  • Step 5 - Geoprocessing - Proximity Analysis - Buffer - Dissolve #2:

  • Next, run the Dissolved Buffer process with the input as schools, proximity distance of 1 KM and named schools_buffer_1km_dissolved:

Dissolve Parameters

  • Dissolved Buffer Result:

Dissolved Buffer Result

  • Step 6 - Geoprocessing - Overlay Analysis - Intersect:

  • With Intersect, the goal is to determine concurrence between two layers; in this case, the roads buffer and the schools buffer, both dissolved.

  • Select the Intersect tool:

Access Intersection Tool

  • Populate the tool as follows, and name the output road_school_buffers_intersect into the .gpkg:

Intersection Parameters

  • Intersect Result:

Intersection Result

  • Step 7 - Geoprocessing - Overlay Analysis - Extract by location:

  • At this stage, 3 of the 5 criteria have been met and exist in the intersection of Step 6:

  • Inside the city of Swellendam

  • within 1km of a school

  • <= 50m distance from a road

  • Now buildings that meet 3 of the 5 conditions will be extracted into a new layer, and the remaining 2 criteria will be enacted on this new layer.

  • In the Processing Toolbox, find the Extract by Location tool:

Extract by Location

  • populate the tool as follows, naming the output well_located_houses into the .gpkg:

Note: initially this will result in one feature that has invalid geometry. Rerun after fixing the geometry (Processing Toolbox > Fix geometries), as was done in Class 6 assignment:

Extract by Location Parameters

  • Fix geometries as needed. Result can be held as temporary layer:

Fix Geometries as Needed

Fix Geometries as Needed

  • Rerun the Extract by Location tool, populate the tool with the fixed geometry, naming the output well_located_houses into the .gpkg

  • Corrected result Extract by Location - well_located_houses:

Corrected Result

  • Step 8 - Geoprocessing - Proximity Analysis - Buffer - Dissolve:

  • Next, run the Dissolved Buffer process with the input as restaurants, proximity distance of 500 meters and named restaurants_buffer_500m_dissolved:

Buffer Parameters

  • Buffer Dissolve Result:

Buffer Dissolve Result

  • Step 9 - Geoprocessing - Select by Location:

  • Next, run a Select by Location, inputing the well_located_houses against the restaurants_buffer_500m_dissolved using the intersect operation:

Select by Location

  • Select creating new selection under Modify current selection by:

Select by Location Parameters

  • Export this selection (Save Selected Features As) houses_restaurants_500m into the .gpkg:

Export Selection

  • Check the result:

Export Result

  • Step 10 - Areal Calculation - Field Calculator:

  • Within the new houses_restaurants_500m layer, open Field Calculator and create a new field AREA for the Areal calculation for square meters:

Area Calculation

  • Toogle OFF editing and save the revisions in houses_restaurants_500m

  • Next and final, make the selection of buildings that are greater than 100 square meters in size. Utilize the Query Builder from houses_restaurants_500m > Filter, populating with the following expression:

Query Builder

  • This will result in 994 features, or 80% of the houses_restaurants_500m input of 1241 building features:

Returned Records

  • Check the final analysis result:

Final Analysis Result


Further Reference:

Utilize the image below as visual cue for fundmental geoprocessing tasks:

  • Clip
  • Dissolve
  • Intersect
  • Merge
  • Union

Vector Spatial Analysis Tools